﻿using Ninject;
using Ninject.Modules;
using SeaBattle.Domain.Abstract;
using SeaBattle.Domain.Abstract.Services;
using SeaBattle.Domain.Concrete;
using SeaBattle.Domain.Concrete.Services;

namespace SeaBattle.Domain.Factory
{
    public class GameFactory
    {
        private static readonly IKernel Kernel = new StandardKernel(new GameFactoryServices());

        public static IGameRepository GameRepository
        {
            get { return (IGameRepository)Kernel.Get(typeof(IGameRepository)); }
        }

        public static IGameService GameService
        {
            get { return (IGameService)Kernel.Get(typeof(IGameService)); }
        }

        private class GameFactoryServices : NinjectModule
        {
            public override void Load()
            {
                Bind<IGameRepository>().To<GameRepository>();
                Bind<IGameService>().To<GameService>();
            }
        }
    }
}
